<?php
$id = isset($_GET['id']) ? $_GET['id'] : '';

if( $id == '' )
	die('No Pancang Tidak Valid');


// load database class handler
include_once '../config/db_config.php';
include '../library/ezsql/shared/ez_sql_core.php';
include '../library/ezsql/mysql/ez_sql_mysql.php';

// database handler
$db      = new ezSQL_mysql($dbUser, $dbPass, $dbName, $dbHost);

$no_individu = $db->get_var("SELECT `no_individu` FROM `caramel_managerial`.`pancang` WHERE `no_pancang`='".$id."'");

if( $no_individu == NULL ){
	?>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>Not Found</title>
	<link href="include/css/search.css" rel="stylesheet" type="text/css" />
	<script> 
	$("#close").click(function(){
		jQuery(document).trigger('close.facebox');
	});
	</script>
	</head> 
	<body>
		<div id="menu">
			<div class="header">
				<h4>Menu</h4>
				<div class="close"><a id="close" href="#"><img src="images/facebox/closelabel.png"/ title="Tutup"></a></div>
			</div>	
			<h3 align="center">Mohon maaf. Pancang (<?=$id;?>) masih kosong.</h3>
		</div>
	</body>
	</html>	
	<?php	
}
else{
	$section = isset($_GET['s']) ? $_GET['s'] : 'home';

	switch( $section ){
		case 'rawat':
			include 'include/search/search.rawat.php';
			break;
		case 'biografi':		
			include 'include/search/Biografi.class.php';
			$b = new Biografi($db, $id);
			include 'include/search/search.biografi.php';
			break;
		case 'panen':
			include 'include/search/Panen.class.php';
			$b = new Panen($db, $id);
			include 'include/search/search.panen.php';
			break;
		default: // menu
			include 'include/search/search.menu.php';
	}
	$content = ob_end_clean();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="include/css/search.css" rel="stylesheet" type="text/css" />

<script> 
/* muted...
$('.header').mousedown(function(){
	 $('#facebox').draggable({containment: 'body'});
	 $('#facebox').draggable('enable');
	 $('#facebox').draggable('start');
});
$('.header').mouseup(function(){
	$('#facebox').draggable('stop'); 
	$('#facebox').draggable('disable'); 
});	 

*/
$("#close").click(function(){
	jQuery(document).trigger('close.facebox');
});


$("#menu_back").click(function(){
	processBox('menu','<?=$id;?>');
});
$("#menu_biografi").click(function(){
	processBox('biografi','<?=$id;?>');
});
$("#menu_rawat").click(function(){
	processBox('rawat','<?=$id;?>');
});		
$("#menu_panen").click(function(){
	processBox('panen','<?=$id;?>');
});
$("#menu_lain_lain").click(function(){
	processBox('lain_lain','<?=$id;?>');
});	
</script>
</head> 
<body>
	<?=$content;?>
</body>
</html>
<?php
} // end else
?>